package com.tbit.uqbike.client.service.impl;

import com.tbit.uqbike.client.dao.core.BleHelmetDao;
import com.tbit.uqbike.client.pojo.newEntity.BleHelmet;
import com.tbit.uqbike.client.service.BleHelmetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @Author: chen
 * @Description:
 * @Date: 创建于 16:58 2022/9/26
 */
@Service
public class BleHelmetServiceImpl implements BleHelmetService {

    @Autowired
    private BleHelmetDao bleHelmetDao;

    @Override
    public BleHelmet getByMachineId(Integer machineId) {

        return bleHelmetDao.getByMachineId(machineId);
    }

    @Override
    public BleHelmet getByUserCode(String userCode) {

        return bleHelmetDao.getByUserCode(userCode);
    }

    @Override
    public void edit(Integer machineId, int soc) {
        BleHelmet bleHelmet = getByMachineId(machineId);
        bleHelmet.setBatDt(new Date());
        bleHelmet.setSoc(soc);
        bleHelmetDao.edit(bleHelmet);
    }
}
